function A() {
  return new Promise((resolve) => {
    setTimeout(() => {
      console.log('异步A');
      resolve()
    }, 1000)
  })
}
function B() {
  return new Promise((resolve) => {
    setTimeout(() => {
      console.log('异步B');
      resolve()
    }, 500)
  })
}
function C() {
  return new Promise((resolve) => {
    setTimeout(() => {
      console.log('异步C');
      resolve()
    }, 100)
  })
}

// A().then(B)

function* gen() {
  yield A()
  // console.log(c);   // {promise: <pending>, done: false}
  yield B()
  yield C()
}
let g = gen()

g.next().value.then(() => {
  g.next().value.then(() => {
    g.next()
  })
})




